/*
 * File:   WiFi.h
 * Author: Utente
 *
 * Created on 6 giugno 2012, 9.22
 */

#ifndef WiFi_H
#define WiFi_H

//TODO: USER CODE
/*
 * Reset functions
 */
// Reset from pin
void pin_reset(void);
void PWR_reset(void);
void BB_reset(void);
void MAC_reset(void);
void software_reset(void);
void RF_reset(void);

/*
 * Functions for reading and writing registers in short address memory space
 */
// write data in short address register
void write_ZIGBEE_short(unsigned char address, unsigned char data_r);
// read data from short address register
unsigned char read_ZIGBEE_short(unsigned char address);

/*
 * Functions for reading and writing registers in long address memory space
 */
// Write data in long address register
void write_ZIGBEE_long(int address, unsigned char data_r);
// Read data from long address register
unsigned char read_ZIGBEE_long(int address);

/*
* Wake
*/
void set_wake_from_pin(void);
void pin_wake(void);

/*
* Address
*/
void set_short_address(unsigned char * address);
void set_long_address(unsigned char * address);
void set_PAN_ID(unsigned char * address);

/*
* Init ZIGBEE module
*/
void init_ZIGBEE_basic(void);
void init_ZIGBEE_nonbeacon(void);

/*
* PLL
*/
void enable_PLL(void);
void disable_PLL(void);

/*
*  Set CCA mode
*/
void set_CCA_mode(unsigned char CCA_mode);

/*
*  Set RSSI mode
*/
void set_RSSI_mode(unsigned char RSSI_mode);

/*
*  Interrupt
*/
void enable_interrupt(void);

/*
*  Set channel
*/
void set_channel(unsigned char channel_number);

/*
* Set type of device
*/
void nonbeacon_PAN_coordinator_device(void);
void nonbeacon_coordinator_device(void);
void nonbeacon_device(void);

/*
* Tx power
*/
void set_TX_power(unsigned char power);

/*
*  Frame format filter
*/
void set_frame_format_filter(unsigned char fff_mode);

/*
* Reception mode
*/
void set_reception_mode(unsigned char r_mode);

/*
* FIFO
*/
void read_RX_FIFO(void);
void write_TX_normal_FIFO(void);

/*
* ACK request
*/
void set_ACK(void);
void set_not_ACK(void);

/*
*  Encrypt
*/
void set_encrypt(void);
void set_not_encrypt(void);

/*
* Transmit packet
*/
void start_transmit(void);
#endif